package com.kgc.sbt.service.impl;

import com.alibaba.dubbo.config.annotation.Reference;
import com.kgc.sbt.api.RushBApi;
import com.kgc.sbt.service.RushBService;
import com.kgc.sbt.utils.RedisUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created on 2021/8/19.
 * <p>
 * Author : Lcywings
 * <p>
 * Description :
 */
@Service
public class RushBServiceImpl implements RushBService {


    @Reference
    private RushBApi rushBApi;

    @Override
    public boolean initProdStorkToRedis(Integer prodId) {
        return rushBApi.initProdStorkToRedis(prodId);
    }

    @Override
    public boolean lockBuyLimitUser(Integer userId, Integer prodId) {
        return rushBApi.lockBuyLimitUser(userId, prodId);
    }

    @Override
    public boolean checkProdStock(Integer prodId, Integer buyCount) {
        return rushBApi.checkProdStock(prodId, buyCount);
    }

    @Override
    public boolean isProdStockLocked(Integer prodId) {
        return rushBApi.isProdStockLocked(prodId);
    }

    @Override
    public void setTradeOrderTORedis(Integer userId, Integer prodId, String tradeOrderNo) {
        rushBApi.setTradeOrderTORedis(userId, prodId, tradeOrderNo);
    }

    @Override
    public int getCreatedTradeOrderStatus(Integer userId, Integer prodId) {
        return rushBApi.getCreatedTradeOrderStatus(userId, prodId);
    }

    @Override
    public void unlockBuyLimitUser(Integer userId, Integer prodId) {
        rushBApi.unlockBuyLimitUser(userId, prodId);
    }

    @Override
    public void unlockProdStock(Integer prodId) {
        rushBApi.unlockProdStock(prodId);
    }

    @Override
    public void subProdStockNum(Integer prodId, Integer buyCount) {
        rushBApi.subProdStockNum(prodId, buyCount);
    }

    @Override
    public void createBuyLimitTradeOrder(Integer userId, Integer prodId, Integer buyCount, String tradeOrderNo) {
        rushBApi.createBuyLimitTradeOrder(userId, prodId, buyCount, tradeOrderNo);
    }

    @Override
    public Boolean appointment(Integer userId, Integer prodId) {
        return rushBApi.appointment(userId, prodId);
    }

    @Override
    public Boolean isM2Product(Integer prodId) {
        return rushBApi.isM2Product(prodId);
    }

    @Override
    public Boolean isM2ProductBuyTime(Integer prodId) {
        return rushBApi.isM2ProductBuyTime(prodId);
    }

    @Override
    public Boolean isM2ProductBuyTime2(Integer prodId) {
        return rushBApi.isM2ProductBuyTime2(prodId);
    }
}
